package com.lancoo.znbkxx.teacher.aibkTestCoach.questionToMark

import com.lancoo.znbkxx.teacher.aibkTestCoach.networkRequest.entity.QuesMarkInfor

object MarkInforIndexHelp {

    /*
    * 获取试题位置index
    * */
    fun SortIndex_return_ParentVpPosition(quesMarkInfor: QuesMarkInfor, sortIndex: String): Int {
        var parentPosition = -1
        var TypeListSize = quesMarkInfor.TypeList.size
        outLoop@ for (a in 0 until TypeListSize) {
            var QuesListSize = quesMarkInfor.TypeList[a].QuesList.size
            for (b in 0 until QuesListSize) {
                parentPosition += 1
                var SortIndexListSize = quesMarkInfor.TypeList[a].QuesList[b].SortIndexList.size
                for (c in 0 until SortIndexListSize) {
                    var SortIndex = quesMarkInfor.TypeList[a].QuesList[b].SortIndexList[c].SortIndex
                    if (SortIndex == sortIndex) {
                        break@outLoop
                    }
                }
            }
        }
        return parentPosition
    }

    fun SortIndex_return_IndexA(quesMarkInfor: QuesMarkInfor, sortIndex: String): Int {
        var index_A = 0
        var typeListSize = quesMarkInfor.TypeList.size
        outLoop@ for (a in 0 until typeListSize) {
            var QuesListSize = quesMarkInfor.TypeList[a].QuesList.size
            for (b in 0 until QuesListSize) {
                var SortIndexListSize = quesMarkInfor.TypeList[a].QuesList[b].SortIndexList.size
                for (c in 0 until SortIndexListSize) {
                    var SortIndex = quesMarkInfor.TypeList[a].QuesList[b].SortIndexList[c].SortIndex
                    if (SortIndex == sortIndex) {
                        index_A = a
                        break@outLoop
                    }
                }
            }
        }
        return index_A
    }

    fun SortIndex_return_IndexB(quesMarkInfor: QuesMarkInfor, sortIndex: String): Int {
        var index_B = 0
        var typeListSize = quesMarkInfor.TypeList.size
        outLoop@ for (a in 0 until typeListSize) {
            var QuesListSize = quesMarkInfor.TypeList[a].QuesList.size
            for (b in 0 until QuesListSize) {
                var SortIndexListSize = quesMarkInfor.TypeList[a].QuesList[b].SortIndexList.size
                for (c in 0 until SortIndexListSize) {
                    var SortIndex = quesMarkInfor.TypeList[a].QuesList[b].SortIndexList[c].SortIndex
                    if (SortIndex == sortIndex) {
                        index_B = b
                        break@outLoop
                    }
                }
            }
        }
        return index_B
    }

    fun SortIndex_return_IndexC(quesMarkInfor: QuesMarkInfor, sortIndex: String): Int {
        var index_C = 0
        var typeListSize = quesMarkInfor.TypeList.size
        outLoop@ for (a in 0 until typeListSize) {
            var QuesListSize = quesMarkInfor.TypeList[a].QuesList.size
            for (b in 0 until QuesListSize) {
                var SortIndexListSize = quesMarkInfor.TypeList[a].QuesList[b].SortIndexList.size
                for (c in 0 until SortIndexListSize) {
                    var SortIndex = quesMarkInfor.TypeList[a].QuesList[b].SortIndexList[c].SortIndex
                    if (SortIndex == sortIndex) {
                        index_C = c
                        break@outLoop
                    }
                }
            }
        }
        return index_C
    }

    /*
    * 获取题型序号从0开始
    * */
    fun QuesPosition_return_TypeListPosition(quesMarkInfor: QuesMarkInfor, position: Int): Int {
        var positionX = -1
        var TypeListPosition = 0
        var typeListSize = quesMarkInfor.TypeList.size
        outLoop@ for (a in 0 until typeListSize) {
            var QuesListSize = quesMarkInfor.TypeList[a].QuesList.size
            for (b in 0 until QuesListSize) {
                positionX += 1
                if (position == positionX) {
                    TypeListPosition = a
                    break@outLoop
                }
            }
        }
        return TypeListPosition
    }

    /*
* 获取题型序号从0开始
* */
    fun QuesPosition_return_QuesListPosition(quesMarkInfor: QuesMarkInfor, position: Int): Int {
        var positionX = -1
        var QuesListPosition = 0
        var typeListSize = quesMarkInfor.TypeList.size
        outLoop@ for (a in 0 until typeListSize) {
            var QuesListSize = quesMarkInfor.TypeList[a].QuesList.size
            for (b in 0 until QuesListSize) {
                positionX += 1
                if (position == positionX) {
                    QuesListPosition = b
                    break@outLoop
                }
            }
        }
        return QuesListPosition
    }
}